import React from "react";

interface TableColumnOperationBtnInterface {
    button?: Array<{ label: string, value: string }>,
    callBack?: any
}

export const tableColumnOperationBtn = (params: TableColumnOperationBtnInterface) => {
    const btnClick = (e: React.MouseEvent, param: string) => {
        e.stopPropagation()
        params.callBack(param)
    }
    return () =>
        <>
            {params.button?.map((item, index) => {
                return <a key={index} onClick={(e) => {
                    btnClick(e, item.value);
                }}>{item.label}</a>
            })}
        </>
}


